package com.biovr.backend.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.IndexDirection;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * Created by monodev on 2017/4/27.
 */
@ApiModel(value="user")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class User {
    @Id
    private String id;
    @Indexed(unique=true, direction= IndexDirection.DESCENDING, dropDups=true)
    private String username;
    private String password;
    private  String realName;
    private  String gender;
    //头像
    //默认头像
    private String avater="http://oqfkj54c5.bkt.clouddn.com/system-user.png";
    private String phone;
    private String email;
    //注册日期
    private Date registerDate;
    //最后登录日期
    private Date lastLogin;
    //最后登录Ip
    private String lastLoginIp;
    //登录次数
    private Integer loginTimes=0;
    //角色[SUPER,ADMIN,TEACHER,STUDENT]
    private List<String> roles;
    //学校，因学校字段太多，这里只保留两个字段，方便前台获取
    private String schoolId;
    private String schoolName;
    //学生专业
    private Major stuMajor;
    //学生年级
    private Grade stuGrade;
    private Klass stuClass;
    //学号/工号
    private String schoolNum;
    //部门
    private Department teacherDepartment;
    //最后密码修改日期
    private  Date lastPasswordResetDate;
    //状态
    private boolean status=true;

    public User() {
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getRealName() {
        return realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public String getAvater() {
        return avater;
    }

    public void setAvater(String avater) {
        this.avater = avater;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    @DateTimeFormat
    public Date getRegisterDate() {
        return registerDate;
    }

    public void setRegisterDate(Date registerDate) {
        this.registerDate = registerDate;
    }

    @DateTimeFormat
    public Date getLastLogin() {
        return lastLogin;
    }

    public void setLastLogin(Date lastLogin) {
        this.lastLogin = lastLogin;
    }

    public String getLastLoginIp() {
        return lastLoginIp;
    }

    public void setLastLoginIp(String lastLoginIp) {
        this.lastLoginIp = lastLoginIp;
    }

    public Integer getLoginTimes() {
        return loginTimes;
    }

    public void setLoginTimes(Integer loginTimes) {
        this.loginTimes = loginTimes;
    }

    public List<String> getRoles() {
        return roles;
    }

    public void setRoles(List<String> roles) {
        this.roles = roles;
    }

    public String getSchoolId() {
        return schoolId;
    }

    public void setSchoolId(String schoolId) {
        this.schoolId = schoolId;
    }

    public String getSchoolName() {
        return schoolName;
    }

    public void setSchoolName(String schoolName) {
        this.schoolName = schoolName;
    }

    public Major getStuMajor() {
        return stuMajor;
    }

    public void setStuMajor(Major stuMajor) {
        this.stuMajor = stuMajor;
    }

    public Grade getStuGrade() {
        return stuGrade;
    }

    public void setStuGrade(Grade stuGrade) {
        this.stuGrade = stuGrade;
    }

    public Klass getStuClass() {
        return stuClass;
    }

    public void setStuClass(Klass stuClass) {
        this.stuClass = stuClass;
    }

    public String getSchoolNum() {
        return schoolNum;
    }

    public Department getTeacherDepartment() {
        return teacherDepartment;
    }

    public void setTeacherDepartment(Department teacherDepartment) {
        this.teacherDepartment = teacherDepartment;
    }

    public void setSchoolNum(String schoolNum) {
        this.schoolNum = schoolNum;
    }
    @DateTimeFormat
    public Date getLastPasswordResetDate() {
        return lastPasswordResetDate;
    }

    public void setLastPasswordResetDate(Date lastPasswordResetDate) {
        this.lastPasswordResetDate = lastPasswordResetDate;
    }

    public boolean isStatus() {
        return status;
    }

    public void setStatus(boolean status) {
        this.status = status;
    }
}
